package com.myjava.linkedhashset;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Mapdemo {
    public static void main(String[] args) {
        Map<String, Object> map = new HashMap<>();
        map.put("key1","value1");
        map.put("key2","value2");
        map.put("key3","value3");
        map.put("key4","value4");
        map.put("key5","value5");
        System.out.println(map);
        System.out.println(map.keySet());
        System.out.println(map.values());
        System.out.println("--------");
       Set<String> allkeys = map.keySet();

        for (String key:map.keySet()) {
            System.out.println(map.get(key));
        }
//      Iterator<String> it = allkeys.iterator();
//      while(it.hasNext()){
//        String key1 = it.next();
//       Object val=map.get(key1);
//          System.out.println(val);
//
//      }


        Map <String,Object> map1 = new HashMap<>();
        Object ret1 =map1.put("ls",18);
        Object ret2 =map1.put("lw",22);
        Object ret3 =map1.put("ll",21);
        System.out.println(ret1);
        System.out.println(ret2);
        System.out.println(ret3);
        System.out.println(map1);
        Object ret4 =map1.put("ll",30);
        System.out.println(ret4);
        System.out.println(map1);
    }
}
